package com.yuanlrc.hotel.service.service.impl;

import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yuanlrc.hotel.service.mapper.AboutServiceMapper;
import com.yuanlrc.hotel.service.domain.AboutService;
import com.yuanlrc.hotel.service.service.IAboutServiceService;
import com.yuanlrc.common.core.text.Convert;

/**
 * 酒店服务Service业务层处理
 * 
 * @author yuanlrc
 * @date 2020-11-24
 */
@Service
public class AboutServiceServiceImpl implements IAboutServiceService 
{
    @Autowired
    private AboutServiceMapper aboutServiceMapper;

    /**
     * 查询酒店服务
     * 
     * @param id 酒店服务ID
     * @return 酒店服务
     */
    @Override
    public AboutService selectAboutServiceById(Long id)
    {
        return aboutServiceMapper.selectAboutServiceById(id);
    }

    /**
     * 查询酒店服务列表
     * 
     * @param aboutService 酒店服务
     * @return 酒店服务
     */
    @Override
    public List<AboutService> selectAboutServiceList(AboutService aboutService)
    {
        return aboutServiceMapper.selectAboutServiceList(aboutService);
    }

    /**
     * 通过服务项的名称查询记录,判断是否重复
     *
     * @param serviceName 酒店服务项名称
     * @return 酒店服务
     */
    @Override
    public AboutService selectAboutServiceByServiceName(String serviceName) {
        return aboutServiceMapper.selectAboutServiceByServiceName(serviceName);
    }

    /**
     * 查询最新一条酒店服务纪录,用于前台图片展示
     *
     * @return 一条酒店服务纪录
     */
    @Override
    public AboutService selectOneAboutService() {
        return aboutServiceMapper.selectOneAboutService();
    }

    /**
     * 新增酒店服务
     * 
     * @param aboutService 酒店服务
     * @return 结果
     */
    @Override
    public int insertAboutService(AboutService aboutService)
    {
        aboutService.setCtime(new Date());
        return aboutServiceMapper.insertAboutService(aboutService);
    }

    /**
     * 修改酒店服务
     * 
     * @param aboutService 酒店服务
     * @return 结果
     */
    @Override
    public int updateAboutService(AboutService aboutService)
    {
        return aboutServiceMapper.updateAboutService(aboutService);
    }

    /**
     * 删除酒店服务对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAboutServiceByIds(String ids)
    {
        return aboutServiceMapper.deleteAboutServiceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除酒店服务信息
     * 
     * @param id 酒店服务ID
     * @return 结果
     */
    @Override
    public int deleteAboutServiceById(Long id)
    {
        return aboutServiceMapper.deleteAboutServiceById(id);
    }
}
